#!/usr/bin/perl

use strict;
use DBI;
use Digest::MD5 qw(md5_base64);
my $dbh = DBI->connect("DBI:mysql:csworld:127.0.0.1", 'tonberry', 'kewlnet');
my $sth = $dbh->prepare("SELECT nick FROM pendingnicks WHERE time >= 86400 AND noexpire = '0'");
$sth->execute;
my @todel;

while (my $tmp = $sth->fetchrow_array) {

    push @todel, $tmp;

}

foreach my $i (@todel) {

    $sth=$dbh->prepare("DELETE FROM channels WHERE owner = '$i';");
    $sth->execute;
    $sth=$dbh->prepare("DELETE FROM nicks WHERE rnick = '$i';");
    $sth->execute;
    $sth=$dbh->prepare("DELETE FROM users WHERE rnick = '$i';");
    $sth->execute;
}


